home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 332 < prev    next >
Encoding:
Text File  |  1996-08-06  |  2.6 KB  |  53 lines

  1. Newsgroups: comp.std.c
  2. Path: phcoms4.seri.philips.nl!panther!baynes
  3. From: baynes@ukpsshp1.serigate.philips.nl (Stephen Baynes)
  4. Subject: Re: Binary Mode stdin/stdout
  5. Sender: news@ukpsshp1.serigate.philips.nl (account for localnews)
  6. Message-ID: <DMI28r.5Lr@ukpsshp1.serigate.philips.nl>
  7. Date: Fri, 9 Feb 1996 08:29:14 GMT
  8. References: <4f67kg$11g@cortex.dialin.rrze.uni-erlangen.de> <DME74w.4M4@stdc.demon.co.uk> <4fbk81$qk@cortex.dialin.rrze.uni-erlangen.de>
  9. Organization: Philips Semiconductors, Southampton, UK
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Markus Kuhn (mskuhn@unrza3.dialin.rrze.uni-erlangen.de) wrote:
  13. : clive@stdc.demon.co.uk (Clive D.W. Feather) writes:
  14.  
  15. : >In article <4f67kg$11g@cortex.dialin.rrze.uni-erlangen.de>,
  16. : >Markus Kuhn <mskuhn@cip.informatik.uni-erlangen.de> wrote:
  17. : >> Why isn't there a standard way of allowing an ISO C program to switch
  18. : >> the standard input and output into binary transparent mode (as with
  19. : >> the "b" flag in fopen()/freopen() for normal files)?
  20. : >>
  21. : >> Has this just been forgotten or is there a good technical reason?
  22.  
  23. : >On some implementations, this decision has to be made at the time you
  24. : >open the file and can't be changed.
  25.  
  26. : I would already be happy with a portable function that allows to
  27. : switch stdin or stdout to binary mode and that has only a well-defined
  28. : behaviour according to the standard if this switch occurs before any
  29. : byte has been written to or read from the stream. This would cause no
  30. : headaches on your computing fossil (because inserting a newline during
  31. : a later switch would not be non-conforming) and would be sufficient
  32. : for all important applications I can think of (like zcat).
  33.  
  34. You make an assumption that the operating system provides you with a means
  35. of directing binary data into stdin or recieving it from stdout in the first
  36. place. There is nothing to stop an operating system from insisting that 
  37. stdin and stdout are conly onnected to a text terminal. If you are writing 
  38. truely portable code then you would be better to not expect too much from
  39. the OS.
  40.  
  41. [On the other hand I agree it would be useful to switch the mode though one
  42. would have to accept it might fail or be useless - but almost anything to do 
  43. with stdin and stdout can fail or be useless so that is not a bit deal. 
  44. However there are plenty of other things to do with files that would be useful
  45. such as switching from readonly to readwrite and truncating an already open 
  46. file.]
  47.  
  48. --
  49. Stephen Baynes                              baynes@mulsoc2.serigate.philips.nl
  50. Philips Semiconductors Ltd
  51. Southampton                                 My views are my own.
  52. United Kingdom
  53.